package util;

import java.io.File;

public class IoUtils {
    /**
     * As simple as
     * 
     * <pre>
     * OutputStream os = new FileOutputStream(mkdirs(new File(dirPath, fileName)));
     * </pre>
     * 
     * @param file
     * @return same file
     * @see File#mkdirs()
     * @author Mykhaylo Adamovych
     */
    public static final File mkdirs(final File file) {
        if (file == null)
            return null;
        final File dir = file.getParentFile();
        if (dir != null && !dir.exists())
            dir.mkdirs();
        return file;
    }
}
